import React, { Component } from 'react';
import BaseHeader from '@/components/base/baseHeader';
import MingjuContent from '@/components/mingju/MingjuContent';
import GlobalBottom from '@/components/base/GlobalBottom';

import axios from 'axios';
class Com extends Component {
  constructor (props) {
    super(props)
    this.state = {
      list: []
    }
  }

  componentDidMount () {
    console.log(this.props.match.params.sid);
    const sid = this.props.match.params.sid;//2301
    localStorage.setItem('sid',sid);
    var url =`http://poem.daxunxun.com:8000/api/juzi//searchSid?sid=`+sid;
    axios.get(url,{dataType:'json'})
      .then((res) => {
        console.log(res.data)
        this.setState({
          list:res.data
        })
      })
  }

  render () {
    return (
      <div className = "container">
        <BaseHeader />
        <div className="containersWrap">
          <div className = "containers">
            <div className="shiwen_left">
              {
                this.state.list.map((item, index) => {
                  return (
                    <MingjuContent key={index} data = {item} {...this.props}/>
                  )
                })
              }
            </div>
          </div>
          <GlobalBottom />
        </div>
        
      </div>
    )
  }
}

export default Com;
